home *** CD-ROM | disk | FTP | other *** search
/ Compute! Gazette 1986 July / 1986-07.d64 / budget planner (.txt) < prev    next >
Commodore BASIC  |  2022-09-20  |  6KB  |  223 lines

  1. 1 print"[147]"
  2. 100 dev=8:goto1850
  3. 110 printhm$;left$(x$,x);left$(y$,y);:return
  4. 120 a=abs(x)+.005-.5*(dp=0):a1=int(a):a$=mid$(str$(a1),2):ifx<0thena$="-"+a$
  5. 130 ifdpthen a2$=mid$(str$(int((a-a1)*100)),2):iflen(a2$)<2thena2$="0"+a2$
  6. 140 ifdpthena$=a$+"."+a2$
  7. 150 a$=right$(sp$+a$,f):return
  8. 160 a$=left$(sp$,(x-len(a$))/2)+a$:return
  9. 170 fori=1tonw:a=0:forj=0tonr-1:a=a+tb(j,i):next:tb(nr,i)=a:tb(0,i+1)=a:next
  10. 180 fori=1tonw:mm=0:iftb(nr,i)<0thenmm=-1:i=nw
  11. 190 next:return
  12. 200 a$=right$(sp$+"week"+str$(cw),f-2):x=2:y=3:gosub110:print a$;:return
  13. 210 a$="budget planner"+str$(yr):x=40:gosub160
  14. 220 printcl$;fg$;a$:printd$:printea$:ea$=""
  15. 230 gosub280:fori=0tonr:ifmmandi=nrthenprintdebt$;
  16. 240 printhm$;left$(y$,i+5);:a$=tb$(i):gosub150:printa$;fg$;
  17. 250 forj=wtow+2:ifi=nrandtb(i,j)<0thenprintdebt$;
  18. 260 x=tb(i,j):gosub120:printa$;fg$;
  19. 270 next:next:return
  20. 280 gosub200:a=d:b=m:c=yr
  21. 290 forz=1to3
  22. 300 a$=str$(d)+mnth$(m):gosub150:printa$;
  23. 310 gosub580:next
  24. 320 d=a:m=b:yr=c
  25. 330 print"[195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195]"
  26. 340 return
  27. 350 gosub200:x=tb(cr,cw):gosub120:b$=rv$+a$+nv$:x=cc*10:y=cr+5:gosub110
  28. 360 printb$;
  29. 370 getc$:ifc$=""then370
  30. 380 ifc$="+"orc$="-"orc$="."or(c$>="0"andc$<="9")then740
  31. 390 ifc$=up$then610
  32. 400 ifc$=dn$then640
  33. 410 ifc$=lf$then660
  34. 420 ifc$=rt$then700
  35. 430 ifc$=cr$thenreturn
  36. 440 ifc$=bk$theniflen(d$)<>0thenc$="":d$=left$(d$,len(d$)-1):goto740
  37. 450 gosub110:printa$;
  38. 460 ifasc(c$)>132andasc(c$)<141then760
  39. 470 ifc$="[205]"then1650
  40. 480 ifc$="[196]"thendp=notdp:gosub210:goto350
  41. 490 ifc$="[197]"then1730
  42. 500 ifc$="[198]"then1790
  43. 510 ifc$="[215]"then1630
  44. 520 ifc$="[212]"thendev=1:ea$="tape selected[146]":gosub210:goto350
  45. 530 ifc$="[209]"thendev=8:ea$="disk selected[146]":gosub210:goto350
  46. 540 gosub110:printb$:goto370
  47. 550 d=d-7:ifd>=1thenreturn
  48. 560 m=m-1:ifm>=1thend=d+mnth(m):return
  49. 570 yr=yr-1:m=12:d=d+mnth(m):return
  50. 580 d=d+7:ifd<=mnth(m)thenreturn
  51. 590 d=d-mnth(m):m=m+1:ifm<13thenreturn
  52. 600 yr=yr+1:m=1:return
  53. 610 ifcr=0then370
  54. 620 cr=cr-1
  55. 630 gosub110:printa$;:goto350
  56. 640 ifcr<>nr-1thencr=cr+1:goto630
  57. 650 goto370
  58. 660 ifcc<>1thencc=cc-1:cw=cw-1:goto630
  59. 670 ifcw=1then370
  60. 680 cw=cw-1:w=w-1:gosub550
  61. 690 gosub210:goto350
  62. 700 ifcc<>3thencc=cc+1:cw=cw+1:goto630
  63. 710 ifcw=nwthen370
  64. 720 cw=cw+1:w=w+1:gosub580
  65. 730 gosub210:goto350
  66. 740 iflen(d$)<10thend$=d$+c$:printhm$;dn$;d$;left$(sp$,10-len(d$)):goto370
  67. 750 goto370
  68. 760 print hm$;dn$;sp$:printsp$
  69. 770 onasc(c$)-132gosub780,870,980,1090,1100,1250,1330,1400:goto350
  70. 780 x=0:y=0:gosub110:printwh$;"<f1>help   <f2>goto  <e>nd of month "
  71. 790 y=y+1:gosub110:printwh$;"<f3>load[160][160] <f4>save  <f>ind neg     "
  72. 800 y=y+1:gosub110:printwh$;"<f5>+row[160][160] <f6>-row  <m>onthly exp  "
  73. 810 y=y+1:gosub110:printwh$;"<f7>calc[160][160] <f8>prnt  <w>eekly exp   "
  74. 820 y=y+1:gosub110:printwh$;"<q>disk    <t>ape    <d>ecimal      "
  75. 830 y=y+1:gosub110:print"<press any key>   "
  76. 840 geta$:ifa$=""then840
  77. 850 printfg$;
  78. 860 gosub210:return
  79. 870 x=0:y=0:gosub110:printwh$;"*load*[146]"
  80. 880 y=y+1:gosub110:f$="":input"filename";f$:iff$=""then1210
  81. 890 ifde=8then910
  82. 900 open2,1,0,f$:goto920
  83. 910 open15,8,15:open2,8,2,f$+",s,r":gosub2300:ifeathengosub210:goto970
  84. 920 printcl$;dn$;"loading ";f$
  85. 930 input#2,nr,nw,d,m,yr:m0=m:d0=d:y0=yr:cc=1:cr=1:cw=1:w=1:gosub2140
  86. 940 ifde=8thengosub2300:ifeathen970
  87. 950 fori=0tonr:input#2,tb$(i):forj=0tonw:input#2,tb(i,j):nextj,i
  88. 960 gosub170:gosub210
  89. 970 close2:close15:return
  90. 980 x=0:y=0:gosub110:printwh$;"*+row*[146]"
  91. 990 ifnr=18theny=y+1:gosub110:print"-no more room-":goto830
  92. 1000 n$="":y=y+1:gosub110:input"name";n$
  93. 1010 ifn$=""then1080
  94. 1020 y=y+1:gosub110:i$="e":input"(i/e)";i$
  95. 1030 a=-1:ifi$="i"thena=1
  96. 1040 cr=cr+1
  97. 1050 fori=nrtocrstep-1:tb$(i+1)=tb$(i):forj=0tonw:tb(i+1,j)=tb(i,j):nextj,i
  98. 1060 fori=1tonw:tb(cr,i)=0:next:tb$(cr)=left$(n$,10)
  99. 1070 nr=nr+1:tb(cr,0)=a
  100. 1080 gosub210:return
  101. 1090 gosub110:printa$;:gosub170:gosub210:return
  102. 1100 x=0:y=0:gosub110:printwh$;"*goto*[146]"
  103. 1110 y=y+1:gosub110:w$="":input"week";w$
  104. 1120 a=int(val(w$))
  105. 1130 ifleft$(w$,1)="-"orleft$(w$,1)="+"thena=cw+a
  106. 1140 ifa=wthen1200
  107. 1150 ifa>50thena=50
  108. 1160 ifa<=0then1210
  109. 1170 ifa>wthen1220
  110. 1180 w=w-1:gosub550
  111. 1190 ifa<wthen1180
  112. 1200 cw=w:cc=1
  113. 1210 gosub210:return
  114. 1220 w=w+1:gosub580
  115. 1230 ifa>wthen1220
  116. 1240 goto1200
  117. 1250 x=0:y=0:gosub110:printwh$;"*save*[146]"
  118. 1260 y=y+1:gosub110:f$="":input"filename";f$:iff$=""then1210
  119. 1270 ifde=8then1290
  120. 1280 open2,1,2,f$:goto1300
  121. 1290 open15,8,15:open2,8,2,"@0:"+f$+",s,w":gosub2300:ifeathen1320
  122. 1300 print#2,nr;",";nw;",";d0;",";m0;",";y0
  123. 1310 fori=0tonr:print#2,tb$(i):forj=0tonw:print#2,tb(i,j):nextj,i
  124. 1320 close15:close2:gosub170:gosub210:return
  125. 1330 x=0:y=0:gosub110:printwh$;"*-row*[146]"
  126. 1340 ifcr=0theny=y+1:gosub110:print"illegal row":goto830
  127. 1350 y=y+1:gosub110:n$="":input"sure";n$
  128. 1360 ifleft$(n$,1)<>"y"then1210
  129. 1370 nr=nr-1
  130. 1380 fori=crtonr:tb$(i)=tb$(i+1):forj=0tonw:tb(i,j)=tb(i+1,j):nextj,i
  131. 1390 cr=cr-1:goto1210
  132. 1400 q$="":printhm$;wh$;"<prnt>":input"from";q$:ifq$=""then1210
  133. 1410 q1$="":input"to  ";q1$:ifq1$=""thenq1$=q$
  134. 1420 q$="-"+q$:m1=0:fori=1to12:ifmnth$(i)=q$thenm1=i:i=12
  135. 1430 next:m2=0:q1$="-"+q1$:fori=1to12:ifmn$(i)=q1$thenm2=i:i=12
  136. 1440 next:ifm1=0orm2=0thenea$="illegal month":goto1210
  137. 1450 open4,4:cmd4:x=79:a$="budget planner"+str$(y0)
  138. 1460 print"                    "a$:print:m=m0:y=y0:d=d0:q=1
  139. 1470 m2=m2+1:ifm2=13thenm2=1
  140. 1480 ifm<>m1thengosub580:q=q+1:goto1480
  141. 1490 printtab(10);:n=1
  142. 1500 a$=str$(d)+mnth$(m):gosub150:printa$;
  143. 1510 a=m:gosub580:ifa=mthenn=n+1:goto1500
  144. 1520 print:fori=0ton:print"[195][195][195][195][195][195][195][195][195][195]";:next:print
  145. 1530 fori=0tonr:a$=tb$(i):gosub150
  146. 1540 ifi=nrandmmthenprintrv$;a$;nv$;:goto1560
  147. 1550 printa$;
  148. 1560 qq=q+n-1:ifqq>52thenqq=52
  149. 1570 forj=qtoqq:x=tb(i,j):gosub120
  150. 1580 ifi=nrandx<0thenprintrv$;a$;nv$;:goto1600
  151. 1590 printa$;
  152. 1600 nextj:print:nexti
  153. 1610 print:print:q=q+n:ifq<53andm<>m2then1490
  154. 1620 m=m0:d=d0:yr=y0:w=1:cw=1:cc=1:cr=0:print#4:close4:goto1210
  155. 1630 ifd$=""thenreturn
  156. 1640 a=tb(cr,0)*val(d$):fori=cwtonw:tb(cr,i)=a:nexti:d$="":gosub210:goto350
  157. 1650 ifd$=""thenreturn
  158. 1660 a=d:b=m:c=yr:q=w:x=m
  159. 1670 ifw<>cwthengosub580:w=w+1:goto1670
  160. 1680 x=m
  161. 1690 gosub580:w=w+1:ifx=mthen1690
  162. 1700 x=m:w=w-1:gosub550:ifw>52thend=a:m=b:yr=c:w=q:d$="":goto1720
  163. 1710 tb(cr,w)=tb(cr,0)*val(d$):goto1690
  164. 1720 gosub210:goto350
  165. 1730 ifw<>cwthenw=w+1:gosub580:goto1730
  166. 1740 a=d:b=m:c=yr:w=w+1:gosub580:x=m:fl=0
  167. 1750 gosub580:w=w+1:ifx=mthen1750
  168. 1760 gosub550:w=w-1:ifw>50thenfl=-1:goto1760
  169. 1770 cc=1:cw=w:ifflthencc=3:cw=52
  170. 1780 gosub210:goto350
  171. 1790 ifw<>cwthenw=w+1:gosub580:goto1790
  172. 1800 a=d:b=m:c=yr:q=w
  173. 1810 gosub580:w=w+1:iftb(nr,w)>=0andw<>50then1810
  174. 1820 iftb(nr,w)>=0thend=a:m=b:yr=c:w=q:goto350
  175. 1830 cc=1:cw=w
  176. 1840 gosub210:goto350
  177. 1850 dimtb(18,53),tb$(18),mn$(12),mn(12)
  178. 1860 debt$=chr$(28):fg$=chr$(159):hm$=chr$(19):cl$=chr$(147):up$=chr$(145)
  179. 1870 dn$=chr$(17):lf$=chr$(157):rt$=chr$(29):cr$=chr$(13):bk$=chr$(20)
  180. 1880 rv$=chr$(18):nv$=chr$(146):wh$=chr$(5)+rv$
  181. 1890 poke53280,3:poke53281,0:printfg$
  182. 1900 rem for plus 4, prior line is color 0,4,0:color 4,4,7
  183. 1910 printfg$:fori=1to12:readmnt$(i),mnt(i):next
  184. 1920 data -jan,31,-feb,28,-mar,31,-apr,30
  185. 1930 data -may,31,-jun,30,-jul,31,-aug,31
  186. 1940 data -sep,30,-oct,31,-nov,30,-dec,31
  187. 1950 w=1:f=10:dp=-1:nw=52
  188. 1960 sp$="                                       "
  189. 1970 x$="":fori=1to40:x$=x$+rt$:next
  190. 1980 y$="":fori=1to24:y$=y$+dn$:next
  191. 1990 a=fre(x)
  192. 2000 nr=1:cw=1:cr=0:cc=1
  193. 2010 tb$(0)="prevbal":tb(0,0)=1
  194. 2020 tb$(1)="total"
  195. 2030 gosub2070
  196. 2040 gosub350
  197. 2050 ifd$=""then2040
  198. 2060 tb(cr,cw)=tb(cr,0)*val(d$):d$="":x=0:y=1:gosub110:printsp$:goto2040
  199. 2070 a$="budget planner":x=39:gosub160:print"[147]";fg$;a$
  200. 2080 print:printea$:f$="":ea$=""
  201. 2090 input"enter filename";f$
  202. 2100 iff$=""then2170
  203. 2110 gosub890
  204. 2120 ifeathen2070
  205. 2130 return
  206. 2140 x=y0:mnth(2)=28:ifm0>2thenx=x+1
  207. 2150 ifint(x/4)=x/4thenmn(2)=29
  208. 2160 return
  209. 2170 a$="budget planner":x=39:gosub160:print "[147]";fg$;a$
  210. 2180 printd$:input"day   ";dd$:d=val(dd$)
  211. 2190 input"month ";mm$:mm$="-"+mm$
  212. 2200 input"year  ";yr$:yr=val(yr$):y0=yr
  213. 2210 m=0:fori=1to12:ifmn$(i)=mm$thenm=i
  214. 2220 next: